package com.cskaoyan;

import com.cskaoyan.mapper.AccountMapper;
//import com.cskaoyan.mapper.impl.AccountMapperImpl;
import com.cskaoyan.utils.MybatisUtils;
import com.cskaoyan.vo.Account;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

/**
 * 创建日期: 2021/11/29 10:14
 *
 * @author ciggar
 */
public class MybatisMain {



    public static void main(String[] args) throws IOException {


//        AccountMapper accountMapper = new AccountMapperImpl();
        SqlSession sqlSession = MybatisUtils.getSqlSession();

        // 获取到的是Mybatis帮助我们生成的代理对象，即AccountMapper的实现类
        AccountMapper accountMapper = sqlSession.getMapper(AccountMapper.class);


        Account account = accountMapper.selectAccountById(2);

        // sqlSession.selectOne("com.cskaoyan.mapper.AccountMapper.selectAccountById",2);

        System.out.println(account);

    }
}
